﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace smartvoid.templates
{
    public partial class Arbol : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int IdCuenta = 1;


            SqlConnection conn = new SqlConnection("Data Source=localhost;Initial Catalog=SmartV-1;Integrated Security=True");
            string Consulta = "SELECT nombre,idgrupo FROM grupos WHERE idcuenta=" + IdCuenta;
            SqlDataAdapter adapter = new SqlDataAdapter(Consulta, conn);
            DataSet dsNivel = new DataSet();
            adapter.Fill(dsNivel, "Nivel1");

            txtN1T1.Text = dsNivel.Tables[0].Rows[0][0].ToString();

            string PadreNivel1 = dsNivel.Tables[0].Rows[0][1].ToString();

            dsNivel.Clear();

            // ***
            // ****


            Consulta = "Select nombre FROM grupos WHERE idcuenta= " + IdCuenta + " AND idpadre = " + 1;
            adapter = new SqlDataAdapter(Consulta, conn);

            //int CantidadAreasNivel2 = dsNivel.Tables[0].Rows.Count;

            //for (int i = 1; i <= CantidadAreasNivel2; i++)
            //{
               
            //}


            dsNivel = new DataSet();
            adapter.Fill(dsNivel, "Nivel2");


            txtN2T1.Text = dsNivel.Tables[0].Rows[1][0].ToString();
            txtN2T2.Text = dsNivel.Tables[0].Rows[2][0].ToString();
            

            





        }
    }
}